package com.tledu.schedulingDuty.service.impl;

import com.tledu.common.utils.DateUtils;
import com.tledu.common.utils.SecurityUtils;
import com.tledu.schedulingDuty.domain.SchedulingDuty;
import com.tledu.schedulingDuty.domain.vo.SelectListDutyVo;
import com.tledu.schedulingDuty.mapper.SchedulingDutyMapper;
import com.tledu.schedulingDuty.service.ISchedulingDutyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 值班列表Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-04
 */
@Service
public class SchedulingDutyServiceImpl implements ISchedulingDutyService 
{
    @Resource
    private SchedulingDutyMapper schedulingDutyMapper;

    /**
     * 查询值班列表
     * 
     * @param id 值班列表主键
     * @return 值班列表
     */
    @Override
    public SelectListDutyVo selectSchedulingDutyById(Long id)
    {
        return schedulingDutyMapper.selectSchedulingDutyById(id);
    }

    /**
     * 查询值班列表列表
     * 
     * @param schedulingDuty 值班列表
     * @return 值班列表
     */
    @Override
    public List<SelectListDutyVo> selectSchedulingDutyList(SchedulingDuty schedulingDuty)
    {
        return schedulingDutyMapper.selectSchedulingDutyList(schedulingDuty);
    }

    /**
     * 新增值班列表
     * 
     * @param schedulingDuty 值班列表
     * @return 结果
     */
    @Override
    public int insertSchedulingDuty(SchedulingDuty schedulingDuty)
    {
        schedulingDuty.setCreateTime(DateUtils.getNowDate());
        schedulingDuty.setCreateUser(SecurityUtils.getUserId());
        return schedulingDutyMapper.insertSchedulingDuty(schedulingDuty);
    }

    /**
     * 修改值班列表
     * 
     * @param schedulingDuty 值班列表
     * @return 结果
     */
    @Override
    public int updateSchedulingDuty(SchedulingDuty schedulingDuty)
    {
        schedulingDuty.setUpdateTime(DateUtils.getNowDate());
        return schedulingDutyMapper.updateSchedulingDuty(schedulingDuty);
    }

    /**
     * 批量删除值班列表
     * 
     * @param ids 需要删除的值班列表主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingDutyByIds(Long[] ids)
    {
        return schedulingDutyMapper.deleteSchedulingDutyByIds(ids);
    }

    /**
     * 删除值班列表信息
     * 
     * @param id 值班列表主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingDutyById(Long id)
    {
        return schedulingDutyMapper.deleteSchedulingDutyById(id);
    }
}
